<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="public/css/page.css" type="text/css" rel="stylesheet">
<?php require_once 'model/db1.php'; ?>
<?php
if (isset($_POST["submit"]))
    $films = getpage("SELECT * from pages", (int) $_POST["min"], (int) $_POST["max"], $_POST["key"], 10);
else
    $films = getpage("SELECT * from pages", null, null, null, 10);
?>

<div id="khung">
    <form method="post">
        <div id="control">
            Keyword:<input type="tex" name="key" placeholder="Key"/><br>
            Min fans:&nbsp;<input type="tex" name="min" placeholder="Min Fans" /><br>
            Max fins:&nbsp;<input type="tex" name="max" placeholder="Max Fans"/><br>
            <input name="submit" value="Serch" type="submit">
        </div>
    </form>
    <div class="item-head" >
        <div class="name">Name</div>
        <div class="img">Image</div>
        <div class="like"> Like</div>
        <div class="talking">Talking </div>
        <div class="category">Category</div>
        <div class="country">Country</div>
        <div class="description"> Description</div>
    </div>
    <?php foreach ($films as $film) : ?>
        <div class="item">
            <div class="name"><?php echo $film["name"]; ?></div>
            <div class="img"><img src="<?php echo $film["picture"]; ?>" align="left"/></div>
            <div class="like"> <?php echo $film["likes"]; ?></div>
            <div class="talking"> <?php echo $film["talking_about_count"]; ?> </div>
            <div class="category"> <?php echo $film["category"]; ?> </div>
            <div class="country"> <?php echo $film["country"]; ?> </div>
            <div class="description"> <?php echo $film["description"]; ?> </div>
        </div>
    <?php endforeach; ?>
    <div style="clear: both">&nbsp;</div>
</div>